<template>
  <div>
    <el-form v-loading="loading" ref="pram" :model="pram" :rules="rules" label-width="120px" @submit.native.prevent>
      <el-form-item label="状态" prop="status">
        <el-select v-model="pram.status" >
          <el-option :value="1" label="已通过"></el-option>
          <el-option :value="2" label="未通过"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="审核备注" prop="remark">
        <el-input v-model="pram.remark" maxlength="30"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handlerSubmit('pram')">确定 </el-button>
        <el-button @click="close">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import {
  review
} from '@/api/entrepreneurship'
import { Debounce } from '@/utils/validate'

export default {
  name: "EntrepreneurshipReview",
  props: {
    isCreate: {
      type: Number,
      required: true
    },
    editData: {
      type: Object,
      default: null
    },
  },
  data() {
    return {
      loading:false,
      imageList:[],
      pram: {
        id: 0,
        remark:'',
        status:1,
      },
      rules: {
        status: { required: true, message: '请选择状态', trigger: ['blur'] },
        remark: { required: true, message: '请填写备注', trigger: ['blur'] },
      },
    }
  },
  mounted() {
    this.initEditData();
  },
  methods: {
    close() {
      this.$emit('hideEditDialog')
    },
    initEditData() {
      this.pram.id=this.editData.id;
    },
    handlerSubmit:Debounce(function(form) {
      this.$refs[form].validate(valid => {
        if (!valid) return
        this.loading=true;
        review(this.pram).then(data => {
          this.$message.success('保存成功')
          this.$emit('hideEditDialog')
        }).finally(()=>{
          this.loading=false;
        })
      })
    }),
  }
}
</script>
